package TP3.ejercicio2;

import TP2.sorters.AbstractSorter;
import anaydis.sort.SorterType;

import java.util.Comparator;
import java.util.List;

public class ShellSorter extends AbstractSorter {

    Integer[] sequence;

    public ShellSorter(){
        this(SorterType.SHELL);
        sequence = new Integer[3];
        sequence[0] = 10;
        sequence[1] = 4;
        sequence[2] = 1;
    }

    protected ShellSorter(final SorterType type){
        super(type);
    }

    public void setSequence(Integer[] seq){
        sequence = seq;
    }

    public <T> void sort(Comparator<T> comparator, List<T> list){
        HSorter h = new HSorter();
        for(int i = 0; i < sequence.length; i++){
            h.setGap(sequence[i]);
            h.sort(comparator, list);
        }
    }

}
